package com.xmu.prcs.entity;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
 *  植物特征表，细化植物特征，用于精确检索
 * @author frequent
 *
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "plantfeature")
public class PlantFeature implements Serializable{

	private Integer idPlantFeature;
	private String minValue; //数值型中最小值
	private String maxValue; //数值型中最大值
	private Integer grade; //植物形状重要性
	private Plant plant; //植物
	private Feature feature; //对应的特征
	
	public PlantFeature(){
		
	}
	
	@Id
	@GeneratedValue
	@Column(name = "idplantfeature", unique = true, nullable = true)
	public Integer getIdPlantFeature() {
		return idPlantFeature;
	}
	public void setIdPlantFeature(Integer idPlantFeature) {
		this.idPlantFeature = idPlantFeature;
	}
	
	@Column(name = "minvalue", length = 10)
	public String getMinValue() {
		return minValue;
	}
	public void setMinValue(String minValue) {
		this.minValue = minValue;
	}
	
	@Column(name = "maxvalue", length = 10)
	public String getMaxValue() {
		return maxValue;
	}
	public void setMaxValue(String maxValue) {
		this.maxValue = maxValue;
	}
	
	@Column(name = "grade")
	public Integer getGrade() {
		return grade;
	}

	public void setGrade(Integer grade) {
		this.grade = grade;
	}

	@ManyToOne(fetch=FetchType.LAZY , cascade={CascadeType.ALL} )
	@JoinColumn(name="idplant")
	public Plant getPlant() {
		return plant;
	}
	public void setPlant(Plant plant) {
		this.plant = plant;
	}
	
	@OneToOne(optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "idfeature")
	public Feature getFeature() {
		return feature;
	}
	public void setFeature(Feature feature) {
		this.feature = feature;
	}

}
